//
//  ZGWJiBingFengXianJiuZhengFirstTableViewCell.m
//  MyYiJianKangApp
//
//  Created by 张国文 on 16/6/6.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "ZGWJiBingFengXianJiuZhengFirstTableViewCell.h"

#define kGrayCount 0.3

@implementation ZGWJiBingFengXianJiuZhengFirstTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
      //  [self addMySubview];
    }
    return self;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withUserXinXiNameArray:(NSMutableArray *)userXinXiArray userXinXiDic:(NSMutableDictionary *)userXinXiDic shengHuoXiGuanNameArray:(NSMutableArray *)shengHuoXiGuanArray shengHuoXiGuanDic:(NSMutableDictionary *)shengHuoXiGuanDic jiBingShiNameArray:(NSMutableArray *)jiBingShiArray jiBingShiDic:(NSMutableDictionary *)jiBingShiDic
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addMySubviewWithUserXinXiNameArray:userXinXiArray userXinXiDic:userXinXiDic shengHuoXiGuanNameArray:shengHuoXiGuanArray shengHuoXiGuanDic:shengHuoXiGuanDic jiBingShiNameArray:jiBingShiArray jiBingShiDic:jiBingShiDic];
    }
    return self;
}

// 布局
- (void)addMySubviewWithUserXinXiNameArray:(NSMutableArray *)userXinXiNameArray userXinXiDic:(NSMutableDictionary *)userXinXiDic shengHuoXiGuanNameArray:(NSMutableArray *)shengHuoXiGuanNameArray shengHuoXiGuanDic:(NSMutableDictionary *)shengHuoXiGuanDic jiBingShiNameArray:(NSMutableArray *)jiBingShiNameArray jiBingShiDic:(NSMutableDictionary *)jiBingShiDic
{
    // 基因变异
    UILabel *jiYinBianYi = [[UILabel alloc] initWithFrame:CGRectMake(25 * kAdjustParamater, 0, 70 * kAdjustParamater, 20 * kAdjustParamater)];
 //   jiYinBianYi.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    jiYinBianYi.text = @"基因变异";
    jiYinBianYi.textColor = [UIColor blackColor];
    jiYinBianYi.textAlignment = NSTextAlignmentLeft;
    jiYinBianYi.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:jiYinBianYi];
    
    UILabel *fengXianZhiShuLabel = [[UILabel alloc] initWithFrame:CGRectMake(125 * kAdjustParamater, jiYinBianYi.top, 100 * kAdjustParamater, 20 * kAdjustParamater)];
   // fengXianZhiShuLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
   // fengXianZhiShuLabel.text = @"风险指数1.8";
    fengXianZhiShuLabel.textColor = [UIColor blackColor];
    fengXianZhiShuLabel.textAlignment = NSTextAlignmentLeft;
    fengXianZhiShuLabel.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:fengXianZhiShuLabel];
    
    // 家族史
    UILabel *jiaZuShi = [[UILabel alloc] initWithFrame:CGRectMake(25 * kAdjustParamater, jiYinBianYi.bottom + 25 * kAdjustParamater, 70 * kAdjustParamater, 20 * kAdjustParamater)];
  //  jiaZuShi.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    jiaZuShi.text = @"家族史";
    jiaZuShi.textColor = [UIColor blackColor];
    jiaZuShi.textAlignment = NSTextAlignmentLeft;
    jiaZuShi.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:jiaZuShi];
    
    // 家族史的多人按钮
    self.duoRenButtonOfJiaZuShi = [UIButton buttonWithType:UIButtonTypeSystem];
   // duoRenButtonOfJiaZuShi.backgroundColor = [UIColor redColor];
  //  [duoRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"xuanzhong-jibingjiuzheng"] forState:UIControlStateNormal];
    self.duoRenButtonOfJiaZuShi.frame = CGRectMake(125 * kAdjustParamater, jiaZuShi.top + 2 * kAdjustParamater, 16 * kAdjustParamater, 16 * kAdjustParamater);
    self.duoRenButtonOfJiaZuShi.layer.cornerRadius = self.duoRenButtonOfJiaZuShi.width / 2;
    self.duoRenButtonOfJiaZuShi.layer.masksToBounds = YES;
    [self.contentView addSubview:_duoRenButtonOfJiaZuShi];
    
    // 家族史多人label
    UILabel *duoRenLabelOfJiaZuShi = [[UILabel alloc] initWithFrame:CGRectMake(self.duoRenButtonOfJiaZuShi.right + 10 * kAdjustParamater, jiaZuShi.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
  //  duoRenLabelOfJiaZuShi.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    duoRenLabelOfJiaZuShi.text = @"多人";
 //   duoRenLabelOfJiaZuShi.textColor = [UIColor blackColor];
    duoRenLabelOfJiaZuShi.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:duoRenLabelOfJiaZuShi];
    
    // 家族史一人按钮
    self.yiRenButtonOfJiaZuShi = [UIButton buttonWithType:UIButtonTypeSystem];
  //  yiRenButtonOfJiaZuShi.backgroundColor = [UIColor redColor];
  //  [yiRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"xuanzhong-jibingjiuzheng"] forState:UIControlStateNormal];
    self.yiRenButtonOfJiaZuShi.frame = CGRectMake(duoRenLabelOfJiaZuShi.right + 17 * kAdjustParamater, jiaZuShi.top + 2 * kAdjustParamater, 16 * kAdjustParamater, 16 * kAdjustParamater);
    self.yiRenButtonOfJiaZuShi.layer.cornerRadius = self.yiRenButtonOfJiaZuShi.width / 2;
    self.yiRenButtonOfJiaZuShi.layer.masksToBounds = YES;
    [self.contentView addSubview:_yiRenButtonOfJiaZuShi];
    
    // 家族史一人label
    UILabel *yiRenLabelOfJiaZuShi = [[UILabel alloc] initWithFrame:CGRectMake(self.yiRenButtonOfJiaZuShi.right + 10 * kAdjustParamater, jiaZuShi.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
  //  yiRenLabelOfJiaZuShi.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    yiRenLabelOfJiaZuShi.text = @"一人";
 //   yiRenLabelOfJiaZuShi.textColor = [UIColor blackColor];
    yiRenLabelOfJiaZuShi.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:yiRenLabelOfJiaZuShi];
    
    // 家族史无button
    self.wuButtonOfJiaZuShi = [UIButton buttonWithType:UIButtonTypeSystem];
  //  wuButtonOfJiaZuShi.backgroundColor = [UIColor redColor];
 //   [wuButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"xuanzhong-jibingjiuzheng"] forState:UIControlStateNormal];
    self.wuButtonOfJiaZuShi.frame = CGRectMake(yiRenLabelOfJiaZuShi.right + 17 * kAdjustParamater, jiaZuShi.top + 2 * kAdjustParamater, 16 * kAdjustParamater, 16 * kAdjustParamater);
    self.wuButtonOfJiaZuShi.layer.cornerRadius = self.wuButtonOfJiaZuShi.width / 2;
    self.wuButtonOfJiaZuShi.layer.masksToBounds = YES;
    [self.contentView addSubview:_wuButtonOfJiaZuShi];
    
    // 家族史无label
    UILabel *wuLabelOfJiaZuShi = [[UILabel alloc] initWithFrame:CGRectMake(self.wuButtonOfJiaZuShi.right + 10 * kAdjustParamater, jiaZuShi.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
  //  wuLabelOfJiaZuShi.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    wuLabelOfJiaZuShi.text = @"无";
  //  wuLabelOfJiaZuShi.textColor = [UIColor blackColor];
    wuLabelOfJiaZuShi.textAlignment = NSTextAlignmentLeft;
    wuLabelOfJiaZuShi.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:wuLabelOfJiaZuShi];
    
    // 年龄
    UILabel *nianLing = [[UILabel alloc] initWithFrame:CGRectMake(25 * kAdjustParamater, jiaZuShi.bottom + 25 * kAdjustParamater, 70 * kAdjustParamater, 20 * kAdjustParamater)];
  //  nianLing.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    nianLing.text = @"年龄";
    nianLing.textColor = [UIColor blackColor];
    nianLing.textAlignment = NSTextAlignmentLeft;
    nianLing.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:nianLing];
    
    // 年龄大于40
    UILabel *daYuSiShiLabel = [[UILabel alloc] initWithFrame:CGRectMake(125 * kAdjustParamater, nianLing.top, 50 * kAdjustParamater, 20 * kAdjustParamater)];
  //  daYuSiShiLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    daYuSiShiLabel.text = @">40";
  //  daYuSiShiLabel.textColor = [UIColor blackColor];
    daYuSiShiLabel.textAlignment = NSTextAlignmentLeft;
    daYuSiShiLabel.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:daYuSiShiLabel];
    
    // 小于40
    UILabel *xiaoYuSiShiLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.yiRenButtonOfJiaZuShi.left, nianLing.top, 50 * kAdjustParamater, 20 * kAdjustParamater)];
 //   xiaoYuSiShiLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    xiaoYuSiShiLabel.text = @"<=40";
  //  xiaoYuSiShiLabel.textColor = [UIColor blackColor];
    xiaoYuSiShiLabel.textAlignment = NSTextAlignmentLeft;
    xiaoYuSiShiLabel.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:xiaoYuSiShiLabel];
    
   
    
    // 性别
    UILabel *gender = [[UILabel alloc] initWithFrame:CGRectMake(25 * kAdjustParamater, nianLing.bottom + 25 * kAdjustParamater, 70 * kAdjustParamater, 20 * kAdjustParamater)];
//    gender.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    gender.text = @"性别";
    gender.textColor = [UIColor blackColor];
    gender.textAlignment = NSTextAlignmentLeft;
    gender.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:gender];
    
    // 男性性别Image
    UIImageView *nanGenderImageV = [[UIImageView alloc] initWithFrame:CGRectMake(125 * kAdjustParamater, gender.top - 3 * kAdjustParamater, 12 * kAdjustParamater, 26 * kAdjustParamater)];
//    nanGenderImageV.image = [UIImage imageNamed:@"nanxuanzhong-jibingjiuzheng"];
    [self.contentView addSubview:nanGenderImageV];
    
    // 男label
    UILabel *nanLabel = [[UILabel alloc] initWithFrame:CGRectMake(nanGenderImageV.right + 12 * kAdjustParamater, gender.top, 30 * kAdjustParamater, 20 * kAdjustParamater)];
  //  nanLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    nanLabel.text = @"男";
    nanLabel.textAlignment = NSTextAlignmentLeft;
  //  nanLabel.textColor = kCyanColor;
    nanLabel.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:nanLabel];
    
    // 女性别image
    UIImageView *nvGenderImageV = [[UIImageView alloc] initWithFrame:CGRectMake(self.yiRenButtonOfJiaZuShi.left, nanGenderImageV.top, 12 * kAdjustParamater, 26 * kAdjustParamater)];
//    nvGenderImageV.image = [UIImage imageNamed:@"nvweixuanzhong-jibingjiuzheng"];
    [self.contentView addSubview:nvGenderImageV];
    
    // 女label
    UILabel *nvLabel = [[UILabel alloc] initWithFrame:CGRectMake(nvGenderImageV.right + 12 * kAdjustParamater, gender.top, 30 * kAdjustParamater, 20 * kAdjustParamater)];
   // nvLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    nvLabel.text = @"女";
    nvLabel.textAlignment = NSTextAlignmentLeft;
//    nvLabel.textColor = kCyanColor;
    nvLabel.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:nvLabel];
    
    // BMI指数
    UILabel *BMIZhiShu = [[UILabel alloc] initWithFrame:CGRectMake(25 * kAdjustParamater, gender.bottom + 25 * kAdjustParamater, 70 * kAdjustParamater, 20 * kAdjustParamater)];
    //  BMIZhiShu.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    BMIZhiShu.text = @"BMI指数";
    BMIZhiShu.textColor = [UIColor blackColor];
    BMIZhiShu.textAlignment = NSTextAlignmentLeft;
    BMIZhiShu.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:BMIZhiShu];
    
    // BMI指数的值
    UILabel *BMILabel = [[UILabel alloc] initWithFrame:CGRectMake(125 * kAdjustParamater, BMIZhiShu.top, 100 * kAdjustParamater, 20 * kAdjustParamater)];
    //  BMILabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    //    BMILabel.text = @"24-28";
    BMILabel.textColor = kCyanColor;
    BMILabel.textAlignment = NSTextAlignmentLeft;
    BMILabel.font = [UIFont systemFontOfSize:k17Big];
    [self.contentView addSubview:BMILabel];
    
#warning 进行用户信息展示
    NSString *jiYinBianYiString = [userXinXiDic valueForKey:@"基因变异"];
    // 基因变异
    fengXianZhiShuLabel.text = [NSString stringWithFormat:@"风险指数%@", jiYinBianYiString];
    // 家族史一人或者多人
    NSString *jiaZuShiString = [userXinXiDic valueForKey:@"家族史"];
    if ([jiaZuShiString isEqualToString:@"多人"]) {
        [self.duoRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"xuanzhong-jibingjiuzheng"] forState:UIControlStateNormal];
        [self.yiRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"weixuanzhong-jibinghfengxian"] forState:UIControlStateNormal];
        [self.wuButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"weixuanzhong-jibinghfengxian"] forState:UIControlStateNormal];
        duoRenLabelOfJiaZuShi.textColor = [UIColor blackColor];
        yiRenLabelOfJiaZuShi.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
        wuLabelOfJiaZuShi.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
    } else if ([jiaZuShiString isEqualToString:@"一人"]) {
        [self.duoRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"weixuanzhong-jibinghfengxian"] forState:UIControlStateNormal];
        [self.yiRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"xuanzhong-jibingjiuzheng"] forState:UIControlStateNormal];
        [self.wuButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"weixuanzhong-jibinghfengxian"] forState:UIControlStateNormal];
        duoRenLabelOfJiaZuShi.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
        yiRenLabelOfJiaZuShi.textColor = [UIColor blackColor];
        wuLabelOfJiaZuShi.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
    } else if ([jiaZuShiString isEqualToString:@"无"]) {
        [self.duoRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"weixuanzhong-jibinghfengxian"] forState:UIControlStateNormal];
        [self.yiRenButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"weixuanzhong-jibinghfengxian"] forState:UIControlStateNormal];
        [self.wuButtonOfJiaZuShi setBackgroundImage:[UIImage imageNamed:@"xuanzhong-jibingjiuzheng"] forState:UIControlStateNormal];
        duoRenLabelOfJiaZuShi.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
        yiRenLabelOfJiaZuShi.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
        wuLabelOfJiaZuShi.textColor = [UIColor blackColor] ;
    }
    
    // 年龄
    NSInteger nameCount = [[userXinXiDic valueForKey:@"年龄"] integerValue] ;
    if (nameCount > 40) {
        daYuSiShiLabel.textColor = kCyanColor;
        xiaoYuSiShiLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
    } else {
        daYuSiShiLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
        xiaoYuSiShiLabel.textColor = kCyanColor;
    }
    // BMI指数
    float BMIString = [[userXinXiDic valueForKey:@"BMI"] floatValue];
    if (BMIString > 28) {
       BMILabel.text = @">28";
    } else if (BMIString > 24 && BMIString <=28) {
        BMILabel.text = @"24-28";
    } else if (BMIString >= 18.5 && BMIString <= 24) {
        BMILabel.text = @"18.5-24";
    } else if (BMIString < 18.5) {
        BMILabel.text = @"<18.5";
    }
    
    // 性别
    NSString *genderString = [userXinXiDic valueForKey:@"性别"];
    if ([genderString isEqualToString:@"men"]) {
        nanGenderImageV.image = [UIImage imageNamed:@"nanxuanzhong-jibingjiuzheng"];
        nvGenderImageV.image = [UIImage imageNamed:@"nvweixuanzhong-jibingjiuzheng"];
        nanLabel.textColor = kCyanColor;
        nvLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
    } else if ([genderString isEqualToString:@"women"]) {
        nanGenderImageV.image = [UIImage imageNamed:@"nanweixuanzhong-jibingfengxian"];
        nvGenderImageV.image = [UIImage imageNamed:@"nvxuanzhong-jibingjiuzheng"];
        nanLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
        nvLabel.textColor = kCyanColor;
    }
    
#warning  动态布局生活习惯
    for (int i = 0; i < shengHuoXiGuanNameArray.count; i++) {
        NSString *tempName = shengHuoXiGuanNameArray[i];
        // 疾病名字
        UILabel *shengHuoXiGuanNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(25  * kAdjustParamater, BMIZhiShu.bottom + 25 * kAdjustParamater + (25 + 20) * kAdjustParamater * i, 70 * kAdjustParamater, 20 * kAdjustParamater)];
        shengHuoXiGuanNameLabel.text = tempName;
        shengHuoXiGuanNameLabel.textColor = [UIColor blackColor];
        shengHuoXiGuanNameLabel.textAlignment = NSTextAlignmentLeft;
        shengHuoXiGuanNameLabel.font = [UIFont systemFontOfSize:k17Big];
        shengHuoXiGuanNameLabel.tag = 100 + i;
        [self.contentView addSubview:shengHuoXiGuanNameLabel];
        
        // 经常label
        UILabel *jingChangLabel = [[UILabel alloc] initWithFrame:CGRectMake(125 * kAdjustParamater, shengHuoXiGuanNameLabel.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
        jingChangLabel.text = @"经常";
        jingChangLabel.textAlignment = NSTextAlignmentCenter;
        jingChangLabel.font = [UIFont systemFontOfSize:k17Big];
        [self.contentView addSubview:jingChangLabel];
        
        // 经常下方的浅色条
        UILabel *cyanLineOnJingChangLabel = [[UILabel alloc] initWithFrame:CGRectMake(jingChangLabel.left, jingChangLabel.bottom + 3 * kAdjustParamater, jingChangLabel.width, 1 * kAdjustParamater)];
        cyanLineOnJingChangLabel.backgroundColor = kCyanColor;
        [self.contentView addSubview:cyanLineOnJingChangLabel];
        
        // 偶尔label
        UILabel *ouErLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.yiRenButtonOfJiaZuShi.left, shengHuoXiGuanNameLabel.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
        ouErLabel.text = @"偶尔";
        ouErLabel.textAlignment = NSTextAlignmentCenter;
        ouErLabel.font = [UIFont systemFontOfSize:k17Big];
        [self.contentView addSubview:ouErLabel];
        
        // 偶尔下方的浅色条
        UILabel *cyanLineOnOuErLabel = [[UILabel alloc] initWithFrame:CGRectMake(ouErLabel.left, ouErLabel.bottom + 3 * kAdjustParamater, ouErLabel.width, 1 * kAdjustParamater)];
        cyanLineOnOuErLabel.backgroundColor = kCyanColor;
        [self.contentView addSubview:cyanLineOnOuErLabel];
        
        // 无label
        UILabel *wuLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.wuButtonOfJiaZuShi.left, shengHuoXiGuanNameLabel.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
        wuLabel.text = @"否";
        wuLabel.textAlignment = NSTextAlignmentCenter;
        wuLabel.font = [UIFont systemFontOfSize:k17Big];
        [self.contentView addSubview:wuLabel];
        
        // 无下方的浅色条
        UILabel *cyanLineOnWuLabel = [[UILabel alloc] initWithFrame:CGRectMake(wuLabel.left, wuLabel.bottom + 3 * kAdjustParamater, wuLabel.width, 1 * kAdjustParamater)];
        cyanLineOnWuLabel.backgroundColor = kCyanColor;
        [self.contentView addSubview:cyanLineOnWuLabel];
       
        
        // 获取对应生活习惯的值
        NSString *tempNameCount = [shengHuoXiGuanDic valueForKey:tempName];
        if ([tempNameCount isEqualToString:@"1"]) {
            // 经常
            jingChangLabel.textColor = kCyanColor;
            ouErLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            wuLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            cyanLineOnJingChangLabel.hidden = NO;
            cyanLineOnOuErLabel.hidden = YES;
            cyanLineOnWuLabel.hidden = YES;
        } else if ([tempNameCount isEqualToString:@"2"]) {
            // 偶尔
            jingChangLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            ouErLabel.textColor = kCyanColor;
            wuLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            cyanLineOnJingChangLabel.hidden = YES;
            cyanLineOnOuErLabel.hidden = NO;
            cyanLineOnWuLabel.hidden = YES;
        } else if ([tempNameCount isEqualToString:@"3"]) {
            // 无
            jingChangLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            ouErLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            wuLabel.textColor = kCyanColor;
            cyanLineOnJingChangLabel.hidden = YES;
            cyanLineOnOuErLabel.hidden = YES;
            cyanLineOnWuLabel.hidden = NO;
        }
    }
    // 取出最后一个生活习惯的label
    UILabel *lastShengHuoXiGuanLabel = (UILabel *)[self.contentView viewWithTag:99 + shengHuoXiGuanNameArray.count];
    
#warning  进行疾病史的动态布局
    for (int i = 0; i < jiBingShiNameArray.count; i++) {
        NSString *jiBingName = jiBingShiNameArray[i];
        // 疾病名字
        UILabel *jiBingNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(25  * kAdjustParamater, lastShengHuoXiGuanLabel.bottom + 25 * kAdjustParamater + (25 + 20) * kAdjustParamater * i, 70 * kAdjustParamater, 20 * kAdjustParamater)];
        jiBingNameLabel.text = jiBingName;
        jiBingNameLabel.textColor = [UIColor blackColor];
        jiBingNameLabel.textAlignment = NSTextAlignmentLeft;
        jiBingNameLabel.font = [UIFont systemFontOfSize:k17Big];
        jiBingNameLabel.tag = 200 + i;
        [self.contentView addSubview:jiBingNameLabel];
        
        // 严重label
        UILabel *yanZhongLabel = [[UILabel alloc] initWithFrame:CGRectMake(125 * kAdjustParamater, jiBingNameLabel.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
        yanZhongLabel.text = @"严重";
        yanZhongLabel.textAlignment = NSTextAlignmentCenter;
        yanZhongLabel.font = [UIFont systemFontOfSize:k17Big];
        [self.contentView addSubview:yanZhongLabel];
        // 严重下方的浅色条
        UILabel *cyanLineOnYanZhongLabel = [[UILabel alloc] initWithFrame:CGRectMake(yanZhongLabel.left, yanZhongLabel.bottom + 3 * kAdjustParamater, yanZhongLabel.width, 1 * kAdjustParamater)];
        cyanLineOnYanZhongLabel.backgroundColor = kCyanColor;
        [self.contentView addSubview:cyanLineOnYanZhongLabel];
        
        // 轻微label
        UILabel *qingWeiLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.yiRenButtonOfJiaZuShi.left, jiBingNameLabel.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
        qingWeiLabel.text = @"轻微";
        qingWeiLabel.textAlignment = NSTextAlignmentCenter;
        qingWeiLabel.font = [UIFont systemFontOfSize:k17Big];
        [self.contentView addSubview:qingWeiLabel];
        // 轻微下方的浅色条
        UILabel *cyanLineOnQingWeiLabel = [[UILabel alloc] initWithFrame:CGRectMake(qingWeiLabel.left, qingWeiLabel.bottom + 3 * kAdjustParamater, qingWeiLabel.width, 1 * kAdjustParamater)];
        cyanLineOnQingWeiLabel.backgroundColor = kCyanColor;
        [self.contentView addSubview:cyanLineOnQingWeiLabel];
        
        // 无label
        UILabel *wuLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.wuButtonOfJiaZuShi.left, jiBingNameLabel.top, 35 * kAdjustParamater, 20 * kAdjustParamater)];
        wuLabel.text = @"无";
        wuLabel.textAlignment = NSTextAlignmentCenter;
        wuLabel.font = [UIFont systemFontOfSize:k17Big];
        [self.contentView addSubview:wuLabel];
        // 无下方的浅色条
        UILabel *cyanLineOnWuLabel = [[UILabel alloc] initWithFrame:CGRectMake(wuLabel.left, wuLabel.bottom + 3 * kAdjustParamater, wuLabel.width, 1 * kAdjustParamater)];
        cyanLineOnWuLabel.backgroundColor = kCyanColor;
        [self.contentView addSubview:cyanLineOnWuLabel];
        
        // 取出对应疾病的数值
        NSString *jiBingNameCount = [jiBingShiDic valueForKey:jiBingName];
        if ([jiBingNameCount isEqualToString:@"1"]) {
            // 严重
            yanZhongLabel.textColor = kCyanColor;
            qingWeiLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            wuLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            cyanLineOnYanZhongLabel.hidden = NO;
            cyanLineOnQingWeiLabel.hidden = YES;
            cyanLineOnWuLabel.hidden = YES;
        } else if ([jiBingNameCount isEqualToString:@"2"]) {
            // 轻微
            yanZhongLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            qingWeiLabel.textColor = kCyanColor;
            wuLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            cyanLineOnYanZhongLabel.hidden = YES;
            cyanLineOnQingWeiLabel.hidden = NO;
            cyanLineOnWuLabel.hidden = YES;
        } else if ([jiBingNameCount isEqualToString:@"3"]) {
            // 无
            yanZhongLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            qingWeiLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:kGrayCount];
            wuLabel.textColor = kCyanColor;
            cyanLineOnYanZhongLabel.hidden = YES;
            cyanLineOnQingWeiLabel.hidden = YES;
            cyanLineOnWuLabel.hidden = NO;
        }
        
       
    }
    
    // 取出最后一个疾病史的label
    UILabel *lastJiBingShiLabel = (UILabel *)[self.contentView viewWithTag:199 + jiBingShiNameArray.count];
    
    // 底部灰色条
    self.bottomGrayLine = [[UILabel alloc] initWithFrame:CGRectMake(0, lastJiBingShiLabel.bottom + 30 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    self.bottomGrayLine.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.contentView addSubview:_bottomGrayLine];
    
}

@end
